﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>编辑物料产品</title>
    <link href="~/libs/layui-v2.9.17/layui/css/layui.css" rel="stylesheet" />
    <script src="~/libs/layui-v2.9.17/layui/layui.js"></script>
    <script src="~/libs/jquery/jquery.js"></script>
</head>
<body>
    <form class="layui-form" action="" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label">物料编码</label>
            <div class="layui-input-block">
                <input type="text" id="itemCode" name="itemCode" lay-verify="required" placeholder="请输入物料编码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">物料名称</label>
            <div class="layui-input-block">
                <input type="text" id="itemName" name="itemName" lay-verify="required" placeholder="请输入物料名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">规格型号</label>
            <div class="layui-input-block">
                <input type="text" id="specification" name="specification" lay-verify="required" placeholder="请输入规格型号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单位</label>
            <div class="layui-input-block">
                <input type="text" id="unitOfMeasu" name="unitOfMeasu" lay-verify="required" placeholder="请输入单位" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">所属分类</label>
            <div class="layui-input-block">
                <input type="text" id="itemTypeName" name="itemTypeName" lay-verify="required" placeholder="请输入所属分类" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input type="radio" id="enableFlag" name="enableFlag" value="是" title="是" checked>
                <input type="radio" id="enableFlag" name="enableFlag" value="否" title="否">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否设置安全库存</label>
            <div class="layui-input-block">
                <input type="radio" id="safeStockFlag" name="safeStockFlag" value="是" title="是" checked>
                <input type="radio" id="safeStockFlag" name="safeStockFlag" value="否" title="否">
            </div>
        </div>
        <input type="hidden" name="id" id="id">
    </form>
    <script type="text/javascript">
        layui.use('form', function () {
            const form = layui.form;
            form.render();
            var id = window.location.search.substring(4);
            $.ajax({
                url: '/ChuBoWen/GetMditem?id=' + id,
                type: 'get',
                data: $('#form').serialize(),
                success: function (res) {
                    console.log(res);
                    $("#id").val(res.id)
                    $("#itemCode").val(res.itemCode)
                    $("#itemName").val(res.itemName)
                    $("#specification").val(res.specification)
                    $("#unitOfMeasu").val(res.unitOfMeasu)
                    $("#itemTypeName").val(res.itemTypeName)
                    $("#measureId").val(res.measureId)
                    $("#lineId").val(res.lineId)
                    $("#proLineId").val(res.proLineId)
                    $("#proLineId2").val(res.proLineId2)
                    $("#salLineId").val(res.salLineId)
                    $("#proLineId3").val(res.proLineId3)
                    $("#wmLineId").val(res.wmLineId)
                    $("#itemOrProductId").val(res.itemOrProductId)
                    $("#itemTypeId").val(res.itemTypeId)
                    $("#itemTypeCode").val(res.itemTypeCode)
                    $("#enableFlag").val(res.enableFlag)
                    $("#safeStockFlag").val(res.safeStockFlag)
                    $("#minStock").val(res.minStock)
                    $("#maxStock").val(res.maxStock)
                    $("#remark").val(res.remark)
                    $("#createTime").val(res.createTime)
                    $("#createBy").val(res.createBy)
                    $("input[name='enableFlag'][value='" + res.enableFlag + "']").prop('checked', true);
                    $("input[name='safeStockFlag'][value='" + res.safeStockFlag + "']").prop('checked', true);
                }
            });
        })
    </script>
</body>
</html>